from selenium import webdriver
import requests
import time
from pprint import pprint
browser = webdriver.Chrome()
url = 'https://www.qcc.com/weblogin'
browser.get(url)
time.sleep(20)
cookies = browser.get_cookies()
pprint(cookies)
browser.quit()
cookie_dict = {}
for item in cookies:
    cookie_dict[item['name']] = item['value']
pprint(cookie_dict)
url = 'https://www.qcc.com/web/search?key=Microsoft'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'}
response = requests.get(url=url, headers=headers, cookies=cookie_dict)
response.encoding = response.apparent_encoding
html_code = response.text
if '微软（中国）有限公司' in html_code:
    print('登录成功')
else:
    print('登录失败')
